package com.pshcp.doctor.tool;

import com.framework.exception.BizException;
import com.framework.thread.ReqComTool;
import com.framework.tool.CommonTool;
import com.pshcp.doctor.ao.diagnosissettings.SaveDoctorDiagnosisSettings2DiagnosisFlagAO;
import com.pshcp.doctor.ao.diagnosissettings.SaveDoctorDiagnosisSettingsAO;
import com.pshcp.domain.model.DoctorDiagnosisSettings;

/**
 * @Description: TODO
 * @Author: xiaoche
 * @Date: 2022/11/3 20:06
 */
public class DoctorDiagnosisSettingsTool {

    public static DoctorDiagnosisSettings buildDefaultDoctorDiagnosisSettings() {
        DoctorDiagnosisSettings doctorDiagnosisSettings = new DoctorDiagnosisSettings();
        doctorDiagnosisSettings.setDoctorId(ReqComTool.getUserId());
        doctorDiagnosisSettings.setDiagnosisFlag(1);
        doctorDiagnosisSettings.setDayLimitedFlag(0);
        doctorDiagnosisSettings.setDayLimitedQuantity(null);
        doctorDiagnosisSettings.setDefaultReplyFlag(0);
        doctorDiagnosisSettings.setDefaultReplyMessage(null);
        return doctorDiagnosisSettings;
    }

    public static void checkSaveDoctorDiagnosisSettings(SaveDoctorDiagnosisSettingsAO saveDoctorDiagnosisSettingsAO) throws BizException {
        CommonTool.checkObj(saveDoctorDiagnosisSettingsAO.getDiagnosisFlag(), "10060001");
        CommonTool.checkObj(saveDoctorDiagnosisSettingsAO.getDayLimitedFlag(), "10060002");
        if (saveDoctorDiagnosisSettingsAO.getDayLimitedFlag() == 1) {
            CommonTool.checkObj(saveDoctorDiagnosisSettingsAO.getDayLimitedQuantity(), "10060003");
        }
        CommonTool.checkObj(saveDoctorDiagnosisSettingsAO.getDefaultReplyFlag(), "10060004");
        if (saveDoctorDiagnosisSettingsAO.getDefaultReplyFlag() == 1) {
            CommonTool.checkString(saveDoctorDiagnosisSettingsAO.getDefaultReplyMessage(), "10060005");
        }
    }

    public static DoctorDiagnosisSettings buildSaveDoctorDiagnosisSettings(SaveDoctorDiagnosisSettingsAO saveDoctorDiagnosisSettingsAO) {
        DoctorDiagnosisSettings doctorDiagnosisSettings = new DoctorDiagnosisSettings();
        doctorDiagnosisSettings.setDoctorId(ReqComTool.getUserId());
        doctorDiagnosisSettings.setDiagnosisFlag(saveDoctorDiagnosisSettingsAO.getDiagnosisFlag());
        doctorDiagnosisSettings.setDayLimitedFlag(saveDoctorDiagnosisSettingsAO.getDiagnosisFlag());
        doctorDiagnosisSettings.setDayLimitedQuantity(saveDoctorDiagnosisSettingsAO.getDayLimitedQuantity());
        doctorDiagnosisSettings.setDefaultReplyFlag(saveDoctorDiagnosisSettingsAO.getDefaultReplyFlag());
        doctorDiagnosisSettings.setDefaultReplyMessage(saveDoctorDiagnosisSettingsAO.getDefaultReplyMessage());
        return doctorDiagnosisSettings;
    }

    public static DoctorDiagnosisSettings buildSaveDoctorDiagnosisSettings(DoctorDiagnosisSettings doctorDiagnosisSettings,SaveDoctorDiagnosisSettingsAO saveDoctorDiagnosisSettingsAO) {
        doctorDiagnosisSettings.setDiagnosisFlag(saveDoctorDiagnosisSettingsAO.getDiagnosisFlag());
        doctorDiagnosisSettings.setDayLimitedFlag(saveDoctorDiagnosisSettingsAO.getDiagnosisFlag());
        doctorDiagnosisSettings.setDayLimitedQuantity(saveDoctorDiagnosisSettingsAO.getDayLimitedQuantity());
        doctorDiagnosisSettings.setDefaultReplyFlag(saveDoctorDiagnosisSettingsAO.getDefaultReplyFlag());
        doctorDiagnosisSettings.setDefaultReplyMessage(saveDoctorDiagnosisSettingsAO.getDefaultReplyMessage());
        return doctorDiagnosisSettings;
    }

    public static DoctorDiagnosisSettings buildSaveDoctorDiagnosisSettings2DiagnosisFlag(SaveDoctorDiagnosisSettings2DiagnosisFlagAO saveDoctorDiagnosisSettings2DiagnosisFlagAO) {
        DoctorDiagnosisSettings doctorDiagnosisSettings = new DoctorDiagnosisSettings();
        doctorDiagnosisSettings.setDoctorId(ReqComTool.getUserId());
        doctorDiagnosisSettings.setDiagnosisFlag(saveDoctorDiagnosisSettings2DiagnosisFlagAO.getDiagnosisFlag());
        return doctorDiagnosisSettings;
    }

    public static DoctorDiagnosisSettings buildSaveDoctorDiagnosisSettings2DiagnosisFlag(DoctorDiagnosisSettings doctorDiagnosisSettings,SaveDoctorDiagnosisSettings2DiagnosisFlagAO saveDoctorDiagnosisSettings2DiagnosisFlagAO) {
        doctorDiagnosisSettings.setDiagnosisFlag(saveDoctorDiagnosisSettings2DiagnosisFlagAO.getDiagnosisFlag());
        return doctorDiagnosisSettings;
    }

}
